//
//  AppDelegate.m
//  ui send
//
//  Created by lanou3g on 15/11/2.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    //设置用户通知类
    UIUserNotificationSettings *setting =[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeAlert categories:nil];
    //应用程序注册用户通知
    [[UIApplication sharedApplication]registerUserNotificationSettings:setting];
    //实例化一个本地通知的服务
    
    UILocalNotification *localNotification =[UILocalNotification new];
    
    //设置本地通知的出发时间
    [localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:5]];
    //设置本地通知的内容
    [localNotification setAlertBody:@"通知的内容"];
    //锁屏时的内容
    [localNotification setAlertAction:@"查看通知的内容"];
    //设置显示通知的title
    [localNotification setAlertTitle:@"主题主题"];
    //为本地通知设置声音
    [localNotification setSoundName:@"2222.MP3"];
    //为本地通知设置应用程序的角标
    [localNotification setApplicationIconBadgeNumber:1];
    //告诉当前的应用程序添加程序的这个本地通知
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
    //为应用程序添加角标
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:100];
    //
    [localNotification setAlertLaunchImage:@"111"];

    
   
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
